package ooday222;

 class Person {
    String name;
    int age;
    String address;
    Person(String name,int age,String address){
        this.name = name;
        this.age = age;
        this.address = address;
    }

    void eat(){
        System.out.println(name+"正在吃饭...");
    }
    void sleep(){
        System.out.println(name+"正在睡觉...");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁了，家住"+address);
    }
}

 class Student extends Person{
    String className;
    String stuId;
    Student(String name,int age,String address,String className,String stuId){
        super(name,age,address); //传递的是name/age/address的值
        this.className = className;
        this.stuId = stuId;
    }

    void study(){
        System.out.println(name+"正在学习...");
    }
}

class Teacher extends Person{
    double salary;
    Teacher(String name,int age,String address,double salary){
        super(name,age,address);
        this.salary = salary;
    }

    void teach(){
        System.out.println(name+"正在讲课...");
    }
}

 class Doctor extends Person {
    String title;
    Doctor(String name,int age,String address,String title){
        super(name,age,address);
        this.title = title;
    }
    void cut(){
        System.out.println(name+"正在做手术...");
    }

}

class ExtendsTest {
    public static void main(String[] args) {
        Student zs = new Student("田凯",25,"廊坊","jsd2302","001");
        zs.eat();
        zs.sleep();
        zs.sayHi();
        zs.study();
        Teacher ls = new Teacher("王鑫",35,"佳木斯",6000.0);
        ls.eat();
        ls.sleep();
        ls.sayHi();
        ls.teach();
        Doctor ww = new Doctor("周清",46,"山东","主任医师");
        ww.eat();
        ww.sleep();
        ww.sayHi();
        ww.cut();
    }
}


